﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="A_Renewal.aspx.cs" Inherits="QD.Weijie.Web.Passport.A_Renewal" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>会员升级-管理中心</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <style type="text/css">
    .content{ margin-left: auto;margin-right: auto;margin-top: 10px;overflow: hidden;}
    .contenthead{width: 940px;height: 60px;margin-left: auto;margin-right: auto;margin-top: 6px;overflow: hidden;background-color: #E4E4E4;padding-left: 30px;}
     #user_ad {margin-top: 13px;color: #333;font-size: 16px;font-weight: 100;}
     
    .tabs td{height: 50px;}
    .ileft{text-align: right;width: 100px;}
    .iright{padding-left: 20px;}
    table tr td:first-child{text-align: right;width: 150px;}
    table tr td:nth-child(2){padding-left: 10px;}
    .textbox{width: 347px;height: 32px;font-size: 16px;padding-left: 10px;border: 1px solid #ccc;background-color: White;line-height:30px;}
    .bottonupgr{width: 88px;height: 36px;color: White;background-color: #6EC6EE;border: 1px solid white;font-size: 18px;}
    .msg{color: Red; font-size: 14px;}
    .contentnva {padding-left: 30px;margin-top: 20px;padding-bottom: 10px;border-bottom: 1px solid #ccc;color: #A7A7A7;font-size: 14px;}
    .contentnva a{ color:#A7A7A7; text-decoration:none;}
    </style>
    <script>
        function Renewal() {
            var month = 1;
            var gname = $_2("GroupId").options[$_2("GroupId").selectedIndex].text;
            if (gname.indexOf("月度") > -1)
                month = 1;
            else if (gname.indexOf("季度") > -1)
                month = 3;
            else if (gname.indexOf("包年") > -1)
                month = 12;
            else {
                month = 12; //默认12个月
            }
            if (!confirm("升级后不可撤销，确认升级客户吗?"))
                return;

            $.post("ajax/agent.ashx?renewal", { id: "<%=id %>", gid: $("#GroupId").val(), old_gid: "<%= groupid%>", month: month }, function (json) {
                if (json.code != 0) {
                    alert(json.msg);
                    return;
                }
                else {
                    alert("升级成功,到期时间延长至：" + date.format("yyyy-MM-dd"));
                    window.location.href = "a_list.aspx";
                }
            }, "json");
        }

        var date;
        function select() {
            date = new Date(<%=endtime=="" ? "" : "'" + endtime+"'" %>);
            var month = 1;
            if ('<%=endtime %>' == "")
                date = new Date();
            var gname = $_2("GroupId").options[$_2("GroupId").selectedIndex].text;
            if (gname.indexOf("月度") > -1)
                month = 1;
            else if (gname.indexOf("季度") > -1)
                month = 3;
            else if (gname.indexOf("包年") > -1)
                month = 12;

            month = 12; //默认12个月            
            $(".msg").html( "升级后到期时间：" + date.addMonth(month).format("yyyy-MM-dd"));
        }

        Date.prototype.format = function (format) {
            var o ={
                    "M+": this.getMonth() + 1, //month  
                    "d+": this.getDate(),    //day  
                    "h+": this.getHours(),   //hour  
                    "m+": this.getMinutes(), //minute  
                    "s+": this.getSeconds(), //second  
                    "q+": Math.floor((this.getMonth() + 3) / 3),  //quarter  
                    "S": this.getMilliseconds() //millisecond  
                    }
            if (/(y+)/.test(format))
                format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(format))
                    format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
            return format;
        }

        Date.prototype.addMonth = function (num) {
            var tempDate = this.getDate();
            this.setMonth(this.getMonth() + num);
            if (tempDate != this.getDate()) this.setDate(0);
            return this;
        }   
       
        function $_2(id) {
            return document.getElementById(id);
        }
    </script>
</head>
<body>
    <!--#include file="uc/top.html" -->
    <form id="form1" runat="server">
     <input type="hidden" name="id" value="" />
     <input type="hidden" name="ExpiredTime" value="" />
     <input type="hidden" name="SiteCreateTime" value="" />
     <input type="hidden" name="FAction" value="" />
    <div class="content">
        <div class="contenthead"><div id="user_ad"></div></div>
        <div class="contenttabs">
            <div class="contentnva">
                客户管理><a href="a_list.aspx">客户列表</a>><samp style="color: #F47A0D;">续费升级</samp>
            </div>
            <div style="margin-top: 20px; margin-bottom: 100px;">
                <table class="tabs" cellpadding="6">
                    <tbody>
                        <tr>
                            <td class="ileft">
                                您的账户余额：
                            </td>
                            <td style="font-size: 14px; font-weight: bold; color: #ff8800">
                                <input type="text" disabled="disabled" class="textbox" value="<%= balance %>" />
                            </td>
                        </tr>
                        <tr>
                            <td class="ileft">
                                当前折扣：
                            </td>
                            <td>
                             <input type="text" disabled="disabled" class="textbox" value="<%=discount %>折" />
                                
                            </td>
                        </tr>
                        <tr>
                            <td class="ileft">
                                客户编号：
                            </td>
                            <td>
                               
                                 <input type="text" disabled="disabled" class="textbox" value="<%=id %>" />
                            
                            </td>
                        </tr>
                        <tr>
                            <td class="ileft">
                                客户昵称：
                            </td>
                            <td>
                                 <input type="text" disabled="disabled" class="textbox" value="<%=sitename %>" />                            </td>
                            </td>
                        </tr>
                      
                        <tr>
                            <td>
                                联系方式：
                            </td>
                            <td>
                              <input type="text" disabled="disabled" class="textbox" value="<%=phone %>" />
    
                            </td>
                        </tr>
                        <tr>
                            <td>
                                当前版本：
                            </td>
                            <td>
                                 <input type="text" disabled="disabled" class="textbox" value="<%=groupname %>" />
                                         </td>
                        </tr>
                        <tr>
                            <td>
                                开通时间：
                            </td>
                            <td>
                             <input type="text" disabled="disabled" class="textbox" value="<%=date %>" />
        
                            </td>
                        </tr>
                        <tr>
                            <td>
                                过期时间：
                            </td>
                            <td>
                             <input type="text" disabled="disabled" class="textbox" value="<%=endtime %>" />
                               </td>
                        </tr>
                        <tr>
                            <td>
                                微街秀版本：
                            </td>
                            <td>
                                <select name="GroupId" id="GroupId" style=" height: 36px; font-size: 18px;padding-left: 10px;" onchange="select()">
                                    <option value="0">请选择版本</option>
                                    <%=sbGroup.ToString()%>
                                </select>
                                <label class="msg"></label>
                            </td>
                        </tr>
                         <tr id="wx_hid">
                                <td>
                                </td>
                                <td>
                                    <input type="hidden" value="<%=GroupType %>" id="GroupType" />
                                    <input type="button" value="点击升级 " id="wx_btn" class="bottonupgr" onclick="Renewal()" />&nbsp;&nbsp;&nbsp;
                                    <input type="button" value="返回 " id="Button1" class="bottonupgr" onclick="javascript:window.location.href='a_list.aspx'" />
                                </td>
                            </tr>                      
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    </form>
     <script type="text/javascript">
        var expTime1 = '<%= ExpTime1 %>';
        var expTime3 = '<%= ExpTime3 %>';
        var expTime12 = '<%= ExpTime12 %>';
        var arrPrice = new Array();
        <%= sbPrice.ToString() %>
        var GroupType = $("#GroupType").val();
    
        var hdIsLocked = $("#hdIsLocked").val();
        var userid = $("#UserID").val();
        if (hdIsLocked == 1) {
            document.getElementById("IsLocked").checked = true;
        }
    </script>
    <!--#include file="uc/Footer_Agent.html" -->
</body>
</html>
